Skip to content

[BUG]: Handle version file creation with empty file paths #4552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

sanketkedia
Copy link
Contributor

@sanketkedia sanketkedia commented May 15, 2025

Description of changes

  • Improvements & Bug fixes

    • It can happen that compaction flushes to sysdb with empty file paths. This happens when there are no changes to the segments after applying the logs.
    • The sysdb handles this by keeping the previous segment file paths
    • However versioning missed handling this case in the version file. This led to creation of versions with empty file paths in the version file.
    • Consequently, after GC deletes all old versions and only leaves this version with empty file paths, there is no data on S3.
  • New functionality

Test plan

  • Added a local test with mock s3

Documentation Changes

None

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sanketkedia sanketkedia changed the title [BUG]: Handle version creation with empty file paths [BUG]: Handle version file creation with empty file paths May 15, 2025
@sanketkedia sanketkedia requested review from codetheweb and HammadB May 15, 2025 06:31
@sanketkedia sanketkedia marked this pull request as ready for review May 15, 2025 06:31
Copy link
Contributor

propel-code-bot bot commented May 15, 2025

Fix Version File Creation with Empty File Paths

This PR addresses a bug in the version file creation process. When compaction flushes to sysdb with empty file paths (which happens when there are no changes to segments after applying logs), the system previously failed to handle this case correctly, leading to versions with empty file paths in the version file. After garbage collection, this could result in missing data on S3.

Key Changes:
• Added handling for cases where flushCollectionCompaction.FlushSegmentCompactions is empty
• When empty file paths are encountered, use the previous segment information to maintain data continuity
• Modified methods signature to better support this case

Affected Areas:
• Version file creation logic in table_catalog.go
• Collection and segment handling in coordinator
• Database model interactions

This summary was automatically generated by @propel-code-bot

@@ -21,6 +23,10 @@ type Collection struct {
TotalRecordsPostCompaction uint64
SizeBytesPostCompaction uint64 // Note: This represents the size of the records off the log
LastCompactionTimeSecs uint64
IsDeleted bool
VersionFileName string
CreatedAt time.Time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is created at different than the Ts field?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know. The person with that knowledge decided to leave us :(

@sanketkedia sanketkedia force-pushed the 05-14-_bug_handle_version_creation_with_empty_file_paths branch from ec35f46 to bbf5511 Compare May 17, 2025 00:16
@sanketkedia sanketkedia enabled auto-merge (squash) May 17, 2025 00:27
@sanketkedia sanketkedia merged commit 464c2e5 into main May 17, 2025
71 checks passed
chroma-droid pushed a commit that referenced this pull request May 19, 2025
## Description of changes

- Improvements & Bug fixes
- It can happen that compaction flushes to sysdb with empty file paths.
This happens when there are no changes to the segments after applying
the logs.
  - The sysdb handles this by keeping the previous segment file paths
- However versioning missed handling this case in the version file. This
led to creation of versions with empty file paths in the version file.
- Consequently, after GC deletes all old versions and only leaves this
version with empty file paths, there is no data on S3.

- New functionality

## Test plan
  - Added a local test with mock s3

## Documentation Changes
None
HammadB pushed a commit that referenced this pull request May 20, 2025
This PR cherry-picks the commit 464c2e5
onto rc/2025-05-16. If there are unresolved conflicts, please resolve
them manually.

Co-authored-by: Sanket Kedia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants